package STUDENTS.LEKDINHKHANHVU.OOP.EX4;

import java.util.Scanner;

public class View {
public static void main(String[] args) {
	
	String strTemp= "";
	Scanner sc;

	do{
		System.out.println("Tháng: ");
		sc= new Scanner(System.in);
		strTemp= sc.nextLine();
	}while(strTemp.isEmpty()|| Integer.parseInt(strTemp)<1||Integer.parseInt(strTemp)>12);
	byte bMonth = Byte.parseByte(strTemp);
	
	do{
		System.out.println("Năm: ");
		sc= new Scanner(System.in);
		strTemp= sc.nextLine();
	}while(strTemp.isEmpty());
	int iYear = Integer.parseInt(strTemp);
	
	Controller objController = new Controller();
	DayObject objDay = new DayObject();
	objDay.setThang(bMonth);
	objDay.setNam(iYear);
	int checkDay = objController.CheckDayOfMonth(objDay);
	switch (objDay.getThang()) {
	case 4:
	case 6:
	case 9:
	case 11: System.out.println("Có 30 ngày"); break;
	case 2: {
		if(objDay.getNam() % 400==0 || (objDay.getNam()%100!=0 && objDay.getNam() %4==0)) System.out.println("có 29 ngày");
		else System.out.println("Có 28 ngày");
			} break;
	default: System.out.println(" Có 31 ngày");
		break;
	}
}
}
